package com.yoda.mall.admin.service;


import com.yoda.common.exception.BusinessException;
import com.yoda.common.exception.ErrorResult;
import com.yoda.mall.api.BrandApi;
import com.yoda.mall.model.entity.pms.Brand;
import com.yoda.mall.model.entity.pms.Product;
import com.yoda.mall.model.entity.ums.PmsBrand;
import com.yoda.mall.model.vo.PageResult;
import com.yoda.mall.model.vo.R;
import org.apache.commons.lang.StringUtils;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.multipart.MultipartFile;

import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;

/**
 * @author wangjia
 * @date 2022/12/16
 * @Description
import com.yoda.mall.api.BrandApi;
import com.yoda.mall.model.entity.pms.Brand;
import com.yoda.mall.model.vo.PageResult;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

/**
 * @author shawn
 * @date 2022年 12月 16日 17:35
 */
@Service
public class BrandService {

    @DubboReference
    private BrandApi brandApi;

    /*@Autowired
    private OssTemplate ossTemplate;*/

    //添加品牌
    public void addBrand(Brand brand) {
        brandApi.addBrand(brand);
    }

    //删除品牌
    public void delete(Integer id) {
         brandApi.delete(id);
    }

    //根据品牌名称查询分类列表


    //获取全部品牌列表
    public List<Brand> listAll() {
       return brandApi.listAll();
    }

    //批量删除
    public void deleteIds(List<Integer> ids) {
        brandApi.deleteIds(ids);
    }

    //批量更新厂商状态
    public void updateStatus(Integer factoryStatus, List<Long> ids) {
        brandApi.updateStatus(factoryStatus,ids);
    }

    //批量更新是否显示
    public void updateShowstatus(Integer showStatus, List<Long> ids) {
        brandApi.updateShowstatus(showStatus,ids);
    }

    //更新品牌
    public void updateBrand(Brand brand) {
        brandApi.updateBrand(brand);
    }


    public Brand findById(Long id) {
        return brandApi.findById(id);
    }
    //根据品牌名称查询分类列表
    public PageResult<Brand> findBrand(String keyword, Integer pageNum, Integer pageSiZe) {
      return brandApi.findBrand(pageNum,pageSiZe,keyword);
    }


}





